export default {
    binding(el, binding, vnode) {
        console.log('binding');
        console.log(vnode);
        window.addEventListener('scroll', vnode.context.scrollLoad);
    },

    inserted(el, binding, vnode) {
        const content = el.children[0];
        let h = (content.offsetHeight) - (el.clientHeight);
        if (content.offsetHeight > el.clientHeight) {
            let t = parseInt(h / 40);
            if (t > 2) {
                content.style.animationDuration = `${t}/s`
                content.style.animationDuration = `${t}s`
            } else {
                content.style.animationDuration = `2/s`
                content.style.animationDuration = `2s`
            }
        }else {
            content.children[0].style.display='none'
        }
        window.addEventListener('scroll', vnode.context.scrollLoad);
    },

    componentUpdated(el, binding, vnode, oldVnode){},

    unbind(el, binding, vnode) {
        console.log('unbind');
        window.removeEventListener('scroll', vnode.context.scrollLoad);
    }

}